
<?php

require 'config_inc.php';
require 'dal_common.php';
require 'dal_session.php';
require 'dal_mocool.php';
require 'dal_avatar.php';
require 'api_common.php';

$t_args = get_params(Array(
	'token' => '+token',
	'avatar' => '+avatar'
));
if ($t_args == null) {
	echo 'ERROR=INVALID_PARAMETER;';
	return;
}

$t_userid = dal_session_get($t_args['token']);
if ($t_userid < 0) {
	echo 'ERROR=INVALID_TOKEN;';
	return;
}

$t_result = dal_avatar_update($t_userid, $t_args['avatar']);
if (!$t_result) {
	echo 'ERROR=SYSTEM_ERROR;';
	return;
}

echo 'ERROR=0;';
?>
